Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue:3933 -Multi-node setup for local gradle run #3958

Merged

Conversation

pranikum
Copy link
Contributor

@pranikum pranikum commented Jul 20, 2022

The PR contain changes for enhancing gradle run command to support multinode cluster on local. This change also take in zone count as project parameter for the gradle command. The nodes will be automatically distributed in zones. This will help us in testing multi node setup in local with debugging facilities.

Issues Resolved

#3933

Execute ./gradlew run -PnumNodes=3 -PnumZones=3 to run 3 node cluster with 3 zones.

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@pranikum pranikum requested review from a team and reta as code owners July 20, 2022 05:53
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

Comment on lines 60 to 61
if (project.hasProperty('nodeCount')) {
useCluster testClusters.runMultiNodeTask;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can disrupt other plugins which use the same property. Should we use zoneCount here and have runMultiZoneTask instead ?

Copy link
Member

@saratvemulapalli saratvemulapalli Jul 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 This sounds like a zone aware task. I would rather have it as runMultiZoneTask
Also curious, you've defined both tasks as runMultiNodeTask. Isn't gradle yelling?

Thinking about probably these tasks are unnecessary and we can fold them to one task. Dropped another comment.

@@ -1239,6 +1243,7 @@ private void createConfiguration() {
baseConfig.put("path.logs", confPathLogs.toAbsolutePath().toString());
baseConfig.put("path.shared_data", workingDir.resolve("sharedData").toString());
baseConfig.put("node.attr.testattr", "test");
baseConfig.put("node.attr.availabilityzone", zone);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should put config only for multi zone clusters .
Instead of passing this , can we use project.findProperty instead here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure .. Let me try that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member

@saratvemulapalli saratvemulapalli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets fold them to one task and make it configurable. This will not conflict existing tasks defined by plugins.

@pranikum pranikum force-pushed the multi_node_gradle_run_support branch from 37b1f20 to 2db4aa4 Compare July 21, 2022 13:48
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

Copy link
Member

@saratvemulapalli saratvemulapalli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are nice additions, is there a way we could test them?

@pranikum pranikum changed the title Issue:3933 - Initial Checkin for Multinode setup for local gradle run Issue:3933 -Multi-node setup for local gradle run Jul 21, 2022
@pranikum
Copy link
Contributor Author

These are nice additions, is there a way we could test them?

At present couldn't think of an approach to test it. Also don't see ant test around single node run command.

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@@ -1239,6 +1243,9 @@ private void createConfiguration() {
baseConfig.put("path.logs", confPathLogs.toAbsolutePath().toString());
baseConfig.put("path.shared_data", workingDir.resolve("sharedData").toString());
baseConfig.put("node.attr.testattr", "test");
if (this.project.findProperty("numZones") != null) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we need to check numZones? if (zone != null && !zone.isBlank()) { should be sufficient, right?

Copy link
Contributor Author

@pranikum pranikum Jul 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are passing zone value for the first node as well. Which will be true for the scenario where -PnumZones will not be set. Hence wanted to check the existence of the property. instead of zone variable.
Don't want to add zone attribute for the single node cluster. i.e
./gradlew run .

https://github.com/opensearch-project/OpenSearch/pull/3958/files#diff-a22e2ce210c503bbd47be71cc6e770064e8a9e008738d28fee5b381918f1fb8cR109

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The decision should be made in OpenSearchCluster: this class knows zones configuration (and should either associated node with zone or not).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the decision making to OpensearchCluster class.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TY

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

Copy link
Collaborator

@Bukhtawar Bukhtawar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why call it numZones. All through the code base we use a generic term awareness attribute which could mean a rack/data centre/zone/switch

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@pranikum
Copy link
Contributor Author

Why call it numZones. All through the code base we use a generic term awareness attribute which could mean a rack/data centre/zone/switch

I checked the code again . I see we are using term zone for awareness attribute. Couldn't think of any better way of classification.

https://github.com/opensearch-project/OpenSearch/blob/main/server/src/main/java/org/opensearch/cluster/routing/allocation/decider/AwarenessAllocationDecider.java#L85

@saratvemulapalli
Copy link
Member

@pranikum looks like precommit is failing.
Could you take a look?

Execution failed for task ':build-tools:spotlessJavaCheck'.
> The following files had format violations:
      src/main/java/org/opensearch/gradle/testclusters/OpenSearchCluster.java
          @@ -149,7 +149,7 @@
           ············}
           ········}·else·{
           ············for·(int·i·=·nodes.size();·i·<·numberOfNodes;·i++)·{
          -················addNode(clusterName·+·"-"·+·i,·""·);
          +················addNode(clusterName·+·"-"·+·i,·"");
           ············}
           ········}
           ····}
  

You can run './gradlew :build-tools:spotlessApply' to fix these violations.

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@codecov-commenter
Copy link

codecov-commenter commented Jul 29, 2022

Codecov Report

Merging #3958 (9992f81) into main (fbe93d4) will decrease coverage by 0.05%.
The diff coverage is 0.00%.

@@             Coverage Diff              @@
##               main    #3958      +/-   ##
============================================
- Coverage     70.55%   70.49%   -0.06%     
+ Complexity    57013    56974      -39     
============================================
  Files          4603     4603              
  Lines        274478   274496      +18     
  Branches      40201    40206       +5     
============================================
- Hits         193658   193515     -143     
- Misses        64511    64679     +168     
+ Partials      16309    16302       -7     
Impacted Files Coverage Δ
...nsearch/gradle/testclusters/OpenSearchCluster.java 0.00% <0.00%> (ø)
...opensearch/gradle/testclusters/OpenSearchNode.java 0.00% <0.00%> (ø)
...gations/bucket/composite/CompositeAggregation.java 15.00% <0.00%> (-85.00%) ⬇️
...pensearch/client/cluster/RemoteConnectionInfo.java 0.00% <0.00%> (-68.30%) ⬇️
...a/org/opensearch/client/cluster/SniffModeInfo.java 0.00% <0.00%> (-52.95%) ⬇️
...a/org/opensearch/tasks/TaskCancelledException.java 50.00% <0.00%> (-50.00%) ⬇️
...opensearch/persistent/PersistentTasksExecutor.java 22.22% <0.00%> (-44.45%) ⬇️
.../org/opensearch/client/indices/AnalyzeRequest.java 31.00% <0.00%> (-43.00%) ⬇️
...aggregations/bucket/composite/ParsedComposite.java 44.44% <0.00%> (-40.75%) ⬇️
.../opensearch/client/cluster/RemoteInfoResponse.java 61.53% <0.00%> (-38.47%) ⬇️
... and 488 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@pranikum
Copy link
Contributor Author

@pranikum looks like precommit is failing. Could you take a look?

Execution failed for task ':build-tools:spotlessJavaCheck'.
> The following files had format violations:
      src/main/java/org/opensearch/gradle/testclusters/OpenSearchCluster.java
          @@ -149,7 +149,7 @@
           ············}
           ········}·else·{
           ············for·(int·i·=·nodes.size();·i·<·numberOfNodes;·i++)·{
          -················addNode(clusterName·+·"-"·+·i,·""·);
          +················addNode(clusterName·+·"-"·+·i,·"");
           ············}
           ········}
           ····}
  

You can run './gradlew :build-tools:spotlessApply' to fix these violations.

Done.

@pranikum
Copy link
Contributor Author

pranikum commented Aug 5, 2022

@Bukhtawar , Can we please merge this PR.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2022

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2022

Gradle Check (Jenkins) Run Completed with:

@Bukhtawar Bukhtawar merged commit 24527fc into opensearch-project:main Aug 5, 2022
dreamer-89 pushed a commit to dreamer-89/OpenSearch that referenced this pull request Aug 12, 2022
…#3958)

* Issue:3933 - Multinode setup for local gradle run

Signed-off-by: Pranit Kumar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants